package com.l2jserver.gameserver.scripting.scriptengine.listeners.player;

import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
import com.l2jserver.gameserver.scripting.scriptengine.impl.L2JListener;

/**
 * @author UnAfraid
 */
public abstract class EventListener extends L2JListener
{
	public EventListener(L2PcInstance player)
	{
		super.player = player;
		register();
	}
	
	/**
	 * @return {@code true} if player is on event, {@code false} otherwise.
	 */
	public abstract boolean isOnEvent();
	
	/**
	 * @return {@code true} if player is blocked from leaving the game, {@code false} otherwise.
	 */
	public abstract boolean isBlockingExit();
	
	/**
	 * @return {@code true} if player is blocked from receiving death penalty upon death, {@code false} otherwise.
	 */
	public abstract boolean isBlockingDeathPenalty();
	
	@Override
	public void register()
	{
		if (player != null)
		{
			player.addEventListener(this);
		}
	}
	
	@Override
	public void unregister()
	{
		if (player != null)
		{
			player.removeEventListener(this);
		}
	}
}
